/*
 * @Author: 9ilk 3535851673@qq.com
 * @Date: 2024-11-06 21:30:58
 * @LastEditors: 9ilk 3535851673@qq.com
 * @LastEditTime: 2024-11-08 11:34:51
 * @FilePath: /zhuang/sharemem/Client.cc
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include<cstring>
#include <iostream>
using namespace std;
#include "ShareMemory.hpp"
#include"time.hpp"
#include"Fifo.hpp"

int main()
{
    // 创建共享内存
    Sm.GetShm();
    // 挂接
    Sm.AttachShm();
    gpipe.OpenPipeForWrite();
    struct data * image = (struct data*)Sm.GetAddr();
    // printf("client 虚拟地址：%p\n",strinfo);
    // sleep(1);
    char ch = 'A';
    while(ch <= 'Z')
    {
        strcpy(image->status,"最新");
        strcpy(image->lasttime,GetCurrTime().c_str());
        strcpy(image->image,"xxxxxxxxxx");
        gpipe.Signal();
        sleep(3);
        // strinfo[ch-'A'] = ch;
        // ch++;
    }
    // 去关联
    Sm.DetachShm();

    cout << "client detach done.." << endl;
    return 0;
}